package ObjectClass

object Test {
  def main(args: Array[String]): Unit = {
    val myCounter = new Counter
    myCounter.setPrivateValue(5)
    myCounter.increment(3) //调用方法
    //    println(myCounter.current)//调用无参方法时，可以将省略括号
    val myCounter02 = new Counter02("张三")
    //调用读方法
    //    println(myCounter02.name)
    //调用写方法
    myCounter02.name = "李四"
    //    println(myCounter02.name)
    /**
     * 辅助构造器
     */
    //    println(new Counter03)
    //    println(new Counter03("Jack"))
    //    println(new Counter03("Jack",20))
    /**
     * 单例的使用
     */
    println(Person.newPersonId())
    println(Person.newPersonId())
    println(Person.newPersonId())
  }
}
